/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.goods.service;

import java.util.List;

import com.jeesite.common.dao.CrudDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.goods.dao.ZtFinancialDao;
import com.jeesite.modules.goods.entity.ZtFinancial;

/**
 * 测试数据Service
 * 
 * @author ThinkGem
 * @version 2018-04-22
 */
@Service
@Transactional(readOnly = true)
public class ZtFinancialService extends CrudService<ZtFinancialDao, ZtFinancial> {
	
	/**
	 * 获取单条数据
	 * 
	 * @param testData
	 * @return
	 */
	@Override
	public ZtFinancial get(ZtFinancial ztFinancial) {
		ZtFinancial entity = super.get(ztFinancial);
		if (entity == null) {
			entity = new ZtFinancial();
		}
		return entity;
	}

	
	/**
	 * 查询分页数据
	 * 
	 * @param page
	 *            分页对象
	 * @param testData
	 * @return
	 */
	@Override
	public Page<ZtFinancial> findPage(Page<ZtFinancial> page, ZtFinancial ztFinancial) {
		return super.findPage(page, ztFinancial);
	}
	public List<ZtFinancial> getMh(ZtFinancial ztFinancial) {
		return dao.getMh( ztFinancial);
	}
	
	public Double getTotalComm(ZtFinancial ztFinancial) {
		return dao.getTotalComm( ztFinancial);
	}
	public Double getTodayComm(ZtFinancial ztFinancial) {
		return dao.getTodayComm( ztFinancial);
	}
	
	
	/**
	 * 保存数据（插入或更新）
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void save(ZtFinancial ztFinancial) {
		super.save(ztFinancial);
		
	}


	/**
	 * 删除数据
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void delete(ZtFinancial ztFinancial) {
		super.delete(ztFinancial);
	}

	@Transactional(readOnly = false)
	public long insertBatch(List<ZtFinancial> ztFinancials){
		return dao.insertBatch(ztFinancials);
	}

	@Transactional(readOnly = false)
	public long updatePriceList(List<ZtFinancial> ztFinancials){
		return  dao.updatePriceList(ztFinancials);
	}

	@Transactional(readOnly = false)
	public int updateAdminId(String newAdminId,String ztAdminId){
		return dao.updateAdminId(newAdminId, ztAdminId);
	}
}